﻿using System.Diagnostics;
using System.Windows.Forms;
using SF.Code.Extension.WinAPI;

namespace SG.Ling.AutoTranslator.App
{
    partial class Program
    {
        private void OnDebugMessage(object sender, WinProcMessageEventArgs e)
        {
            var debug = CommandGroup.Debug.ValidateCommand(e);

            var executedSwitch = true;
            switch (debug)
            {
                case Command.Test:
                    MessageBox.Show(e.Args);
                    break;

                case Command.Start:
                    if (!Debugger.IsAttached)
                        Debugger.Launch();
                    break;

                case Command.Break:
                    if (Debugger.IsAttached)
                        Debugger.Break();
                    break;

                default:
                    executedSwitch = false;
                    break;
            }

            if (executedSwitch)
                e.Claimed = ClaimType.Complete;
        }
    }
}
